home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Libris Britannia 4
/
science library(b).zip
/
science library(b)
/
DDJMAG
/
DDJ9110.ZIP
/
STRING.ZIP
/
STRICTOR.CPP
< prev
next >
Wrap
C/C++ Source or Header
|
1991-07-30
|
593b
|
36 lines
#include <string.h>
#include <ctype.h>
#include <errno.h>
#include <string.hpp>
String::String() : rp(0) {}
String::String(const char *s, int count)
{
int n = count? count: strlen(s);
if (n >= 0) {
rp = new(n) srep(n,s);
if (!rp)
errno = ENOMEM;
else
rp->refs++;
} else
rp = 0;
}
String::String(char c)
{
rp = new(1) srep(1,&c);
if (!rp)
errno = ENOMEM;
else
rp->refs++;
}
String::String(const String &s)
{
rp = s.rp;
if (rp)
rp->refs++;
}